Out-of-bounds Write in captive portal

Summary

An out-of-bounds write vulnerability [CWE-787] and a Stack-based Buffer Overflow [CWE-121] in FortiOS & FortiProxy captive portal may allow an inside attacker who has access to captive portal to execute arbitrary code or commands via specially crafted HTTP requests.

Workaround:

Set a non form-based authentication scheme:

config authentication scheme
edit scheme
set method method
next
end

Where <method> can be any of those :

ntlm NTLM authentication.
basic Basic HTTP authentication.
digest Digest HTTP authentication.
negotiate Negotiate authentication.
fsso Fortinet Single Sign-On (FSSO) authentication.
rsso RADIUS Single Sign-On (RSSO) authentication.
ssh-publickey Public key based SSH authentication.
cert Client certificate authentication.
saml SAML authentication

None of the enabled authentication schemes should be form-based.

Please note that only devices with captive portal enabled are affected.

Version Affected Solution
FortiOS 7.4 7.4.0 through 7.4.1 Upgrade to 7.4.2 or above
FortiOS 7.2 7.2.0 through 7.2.5 Upgrade to 7.2.6 or above
FortiOS 7.0 7.0.0 through 7.0.12 Upgrade to 7.0.13 or above
FortiOS 6.4 6.4.0 through 6.4.14 Upgrade to 6.4.15 or above
FortiOS 6.2 6.2.0 through 6.2.15 Upgrade to 6.2.16 or above
FortiProxy 7.4 7.4.0 Upgrade to 7.4.1 or above
FortiProxy 7.2 7.2.0 through 7.2.6 Upgrade to 7.2.7 or above
FortiProxy 7.0 7.0.0 through 7.0.12 Upgrade to 7.0.13 or above
FortiProxy 2.0 2.0.0 through 2.0.13 Upgrade to 2.0.14 or above
FortiProxy 1.2 Not affected Not Applicable
FortiSASE 23.3 Not affected Not Applicable
FortiSASE 23.2 23.2.b Migrate to a fixed release
FortiSASE 23.1 Not affected Not Applicable
FortiSASE 22.4 Not affected Not Applicable
Follow the recommended upgrade path using our tool at: https://docs.fortinet.com/upgrade-tool

Virtual Patch named "FortiOS.Captive.Portal.Out.Of.Bounds.Write." is available in FMWP db update 23.105

Acknowledgement

Internally discovered and reported by Gwendal Guégniaud of Fortinet Product Security Team.

Timeline

2024-02-27: Initial publication
2025-01-24: Move to Advisory table display